﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TrendInfo : MonoBehaviour {

    public List<UISprite> trendList1;
    public List<UISprite> trendList2;
    public List<UISprite> trendList3;
    public List<UISprite> trendList4;

    public List<int> resultList1;
    public List<int> resultList2;
    public List<int> resultList3;
    public List<int> resultList4;

    public GameObject closeBtn;
    public GameObject trendPanel;
	void Start () {
        UIEventListener.Get(closeBtn).onClick = ButtonClick;
        LogMsg();
	}

    void ButtonClick(GameObject button)
    {
        if(button.name == "CloseBtn"){
            Destroy(trendPanel);
        }
    }

    /// <summary>
    /// 加载信息
    /// </summary>
    void LogMsg()
    {
        for (int i = 0; i < resultList1.Count; i++)
        {
            //天
            if(resultList1[i] == 1){
                trendList1[i].spriteName = "sheng";
            }
            else
            {
                trendList1[i].spriteName = "fu";
            }
            //地
            if (resultList2[i] == 1)
            {
                trendList2[i].spriteName = "sheng";
            }
            else
            {
                trendList2[i].spriteName = "fu";
            }
            //玄
            if (resultList3[i] == 1)
            {
                trendList3[i].spriteName = "sheng";
            }
            else
            {
                trendList3[i].spriteName = "fu";
            }
            //黄
            if (resultList4[i] == 1)
            {
                trendList4[i].spriteName = "sheng";
            }
            else
            {
                trendList4[i].spriteName = "fu";
            }


            trendList1[i].width = trendList1[i].GetAtlasSprite().width;
            trendList1[i].height = trendList1[i].GetAtlasSprite().height;
            trendList2[i].width = trendList1[i].GetAtlasSprite().width;
            trendList2[i].height = trendList1[i].GetAtlasSprite().height;
            trendList3[i].width = trendList1[i].GetAtlasSprite().width;
            trendList4[i].height = trendList1[i].GetAtlasSprite().height;
            trendList4[i].width = trendList1[i].GetAtlasSprite().width;
            trendList4[i].height = trendList1[i].GetAtlasSprite().height;

            trendList1[i].gameObject.SetActive(true);
            trendList2[i].gameObject.SetActive(true);
            trendList3[i].gameObject.SetActive(true);
            trendList4[i].gameObject.SetActive(true);
        }
    }
}
